package com.zytech.zspider.core;

import com.zytech.modules.lang.Langs;
import com.zytech.modules.lang.Requires;

import java.util.Map;

/**
 * @author siuming
 */
public final class TaskDefinitionHelper {

    /**
     * @param settings
     * @param name
     * @param defaultValue
     * @return
     */
    public static <T> T getSetting(Map<String, T> settings, String name, T defaultValue) {
        Requires.notNull(settings, "settings must not be null.");
        return Langs.nullSafe(settings.get(name), defaultValue);
    }

    private TaskDefinitionHelper() {
    }
}
